package l2hc.gameserver.network.loginservercon.lspackets;

import l2hc.gameserver.model.Player;
import l2hc.gameserver.network.GameClient;
import l2hc.gameserver.network.loginservercon.LoginServerCommunication;
import l2hc.gameserver.network.loginservercon.ReceivablePacket;
import l2hc.gameserver.network.serverpackets.components.CustomMessage;
import l2hc.gameserver.scripts.Functions;

/**
 * @date 27.04.12
 * @time 11:29
 */
public class ChangePasswordResponse extends ReceivablePacket
{
	String _account;
	boolean _state;

	public void readImpl()
	{
		_account = readS();
		_state = (readD() == 1);
	}

	protected void runImpl()
	{
		GameClient client = LoginServerCommunication.getInstance().getAuthedClient(_account);

		if (client != null)
		{
			Player activeChar = client.getActiveChar();
			if (activeChar != null)
			{
				Functions.sendMessage(new CustomMessage("scripts.handler.voicecommands.password.Result" + String.valueOf(_state), activeChar, new Object[0]), activeChar);
			}
		}
	}
}